#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>

using namespace std;

#define Max 20000


int a[Max], b[Max];


int main(void)
{
	char fst[Max], snd[Max];
	while(gets(fst) != NULL)
	{
		for (int i = 0; fst[i]; ++i)
		{
			a[fst[i] - 'A']--;
		}

		gets(snd);
		for (int i = 0; snd[i]; ++i)
		{
			b[snd[i] - 'A']--;
		}

		sort(a, a + 26);
		sort(b, b + 26);
		
		int flag = 1;
		for (int i = 0; i < 26; ++i)
		{
			if(a[i] != b[i]) 
			{
				flag = 0;
				break;
			}
		}

		if(flag) {
			printf("YES\n");
		} else {
			printf("NO\n");
		}

		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
	}
	return 0;
}